{load header}

<!--/H-->
<!-- 内容区 -->
<div id="main-content">
    <div id="top-alert" class="fixed alert alert-error" style="display: none;">
        <button class="close fixed" style="margin-top: 4px;">&times;</button>
        <div class="alert-content">这是内容</div>
    </div>
    <div id="main" class="main">

        <!-- nav --><!-- nav -->

        <div class="main-title">
            <h2>其他统计</h2>
        </div>
        <div class="cf">
            <span>{$time_start} 00:00 -- {$time_end} 23:59 </span>
            <!-- 高级搜索 -->
            <div class="search-form fr cf">
                <div class="sleft">
                    <div class="sleft">
                        <div class="drop-down sub-plat">
                            <span id="plat-txt" class="sort-txt" data="{$_GET['plat']}">{if $plat_name}{$plat_name}{else}全部来源{/if}</span>
                            <i class="arrow arrow-down"></i>
                            <ul id="sub-plat" class="nav-list hidden" style="z-index: 99">
                                <li><a href="javascript:;" value="0">全部来源</a></li>
                                <!--{loop $plat_list $plat_item}-->
                                <li><a href="javascript:;" value="{$plat_item['value']}">{$plat_item['name']}</a></li>
                                <!--{/loop}-->
                            </ul>
                        </div>
                        <div class="drop-down sub-flag">
                            <span id="flag-txt" class="sort-txt" data="{$_GET['flag']}">{if $flag_name}{$flag_name}{else}全部flag{/if}</span>
                            <i class="arrow arrow-down"></i>
                            <ul id="sub-flag" class="nav-list hidden" style="z-index: 99">
                                <li><a href="javascript:;" value="0">全部flag</a></li>
                                <!--{loop $flag_list $flag_item}-->
                                <li><a href="javascript:;" value="{$flag_item['value']}">{$flag_item['name']}</a></li>
                                <!--{/loop}-->
                            </ul>
                        </div>
                        <input type="text" id="time-start" name="time-start" class="text input-2x"
                               value="{$time_start}" placeholder="起始时间"/> -
                        <input type="text" id="time-end" name="time-end" class="text input-2x"
                               value="{$time_end}" placeholder="结束时间"/>
                        <a class="sch-btn" style="float: none;" href="javascript:;" id="search" url=""><i class="btn-search"></i></a>
                    </div>
                </div>
            </div>
        </div>
        <div class="data-table table-striped tab-content">
            <table>
                <thead>
                <tr>
                    <th>目标</th>
                    <th>点击量</th>
                    <th>去重点击量</th>
                    <th>图表</th>
                </tr>
                </thead>
                <tbody>

                <!--{loop $list['cat_list'] $val}-->
                <tr>
                    <td>{$val['title']}</td>
                    <td>{$val['views_num']}</td>
                    <td>{$val['views_num_removal']}</td>
                    <td><a href="{eval echo site_url('statistics/custstat_chart')}?cat_id={$val['id']}&plat={$_GET['plat']}&flag={$_GET['flag']}">图表</a></td>
                </tr>
                <!--{/loop}-->
                </tbody>
            </table>
            <!-- 分页 -->
            <div class="page">
                <div>
                    {$showpage}
                    <span class="rows">共 {$Total} 条记录</span>
                    <!--
                    <span class="rows" >金额总计 <font color="#F90">{$T_total['total']}</font> 元</span>
        <a target ="_blank;" href="{eval echo site_url('borrow/index_to_excel')}?{eval echo $_SERVER['QUERY_STRING'];}" >导出结果</a>
                    -->

                </div>
            </div>
        </div>

    </div>
</div>
<link href="{eval echo base_url()}static/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<link href="{eval echo base_url()}static/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript"
        src="{eval echo base_url()}static/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript"
        src="{eval echo base_url()}static/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"
        charset="UTF-8"></script>
<script type="text/javascript">
    $(function () {
        //搜索功能
        $("#search").click(function () {

            var url = $(this).attr('url');
            var plat = $("#plat-txt").attr("data");
            var flag = $("#flag-txt").attr("data");
            var query = $('.search-form').find('input').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
            query = query.replace(/^&/g, '');
            if (plat != '') {
                query += '&plat=' + plat;
            }
            if (flag != '') {
                query += '&flag=' + flag;;
            }
            if (url.indexOf('?') > 0) {
                url += '&' + query;
            } else {
                url += '?' + query;
            }
            window.location.href = url;
        });

        /* 状态搜索子菜单 */
        $(".search-form").find(".sub-plat").hover(function () {
            $("#sub-plat").removeClass("hidden");
        }, function () {
            $("#sub-plat").addClass("hidden");
        });
        $("#sub-plat li").find("a").each(function () {
            $(this).click(function () {
                var text = $(this).text();
                $("#plat-txt").text(text).attr("data", $(this).attr("value"));
                $("#sub-plat").addClass("hidden");
            })
        });
        $(".search-form").find(".sub-flag").hover(function () {
            $("#sub-flag").removeClass("hidden");
        }, function () {
            $("#sub-flag").addClass("hidden");
        });
        $("#sub-flag li").find("a").each(function () {
            $(this).click(function () {
                var text = $(this).text();
                $("#flag-txt").text(text).attr("data", $(this).attr("value"));
                $("#sub-flag").addClass("hidden");
            })
        });

        //回车自动提交
        $('.search-form').find('input').keyup(function (event) {
            if (event.keyCode === 13) {
                $("#search").click();
            }
        });

        $('#time-start').datetimepicker({
            format: 'yyyy-mm-dd',
            language: "zh-CN",
            minView: 2,
            autoclose: true
        });

        $('#time-end').datetimepicker({
            format: 'yyyy-mm-dd',
            language: "zh-CN",
            minView: 2,
            autoclose: true,
            pickerPosition: 'bottom-left'
        })


    })
</script>
<!--F-->{load footer}